package com.matrix.im.utils;

import org.owasp.html.PolicyFactory;
import org.owasp.html.Sanitizers;

/**
 * @author 有点甜
 * @since 2025/8/10
 */
public class XssSanitizerUtil {

    private static final PolicyFactory POLICY_FACTORY = Sanitizers.FORMATTING;

    public static String sanitize(String untrustedHTML) {
        if (untrustedHTML == null) {
            return null;
        }
        return POLICY_FACTORY.sanitize(untrustedHTML);
    }
}
